<template>
	<view class="container">
		<tui-list-cell :hover="false">
			<view class="tui-line-cell">
				<view class="tui-title">姓名</view>
				<input placeholder-class="phcolor" class="tui-input" v-model="nick_name" placeholder="请输入姓名" maxlength="20" type="text" />
			</view>
		</tui-list-cell>
		<view class="s-btn" @tap="primary">确定</view>
	</view>
</template>
<script>
	import tuiListCell from "@/components/list-cell/list-cell"
	import EditNickName from './edit_nick_name-model.js'
	var edit_nick_name = new EditNickName(); 
	export default {
		components: {
			tuiListCell
		},
		data() {
			return {
				nick_name:'',//姓名
			}
		},
		onLoad: function() {
			var that = this;
			that.my();
		},
		methods: {
			//我的信息
			my(){
				var that = this;
				edit_nick_name.my((res)=>{
					if(res.code==8888){
						that.nick_name = res.data.nick_name;
					}
				})
			},
			primary(){
				var that = this;
				if(that.nick_name == ''){
					edit_nick_name.show_tips({title: '请输入昵称！'});
					return;
				}
				edit_nick_name.edit_nick_name(that.nick_name,(res)=>{
					if(res.code == 8888){
						edit_nick_name.switch_tab('../my/my');
					}
				});
				
			}
		}
	}
</script>
<style>
	@import url("edit_nick_name.css");
</style>
